package com.company.instance;

/**
 * 饿汉模式 延迟加载
 */
public class InstanceTest1 {


    private InstanceTest1(){

    }
    static class InstanceTest1Load{
        static InstanceTest1 instanceTest1=new InstanceTest1();
        public static  InstanceTest1 getInstance() {
            return instanceTest1;
        }
//        static public InstanceTest1 getInstance(){
//            if(instanceTest1==null){
//                instanceTest1=new InstanceTest1();
//            }
//            return instanceTest1;
//        }
    }


    public static InstanceTest1 getInstance(){
        return InstanceTest1Load.getInstance();
    }

    @Override
    public String toString() {
        return "InstanceTest1{}";
    }
}
